let originData = {
    name: 'jiecheng',
    age: 24
}
const validators = {
    name(val){
        return typeof val === 'string'
    },
    age(val){
        return typeof val === 'number'
    }
}
entries
function createValidator(target,validators){
    return new Proxy(originData, {
        set(target, propkey, value, proxy){
            let validate = validators[propkey](value)
            if(validate){
                return value
            }else{
                throw Error(`Cannot set ${propkey} to ${value}. Invalid type.`)
            }
        }
    })
}

const proxyData = createValidator(originData, validators)

proxyData.name = '胡嘉庆'
proxyData.age = '2323s'